package com.example.thread;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;

//@Component
public class SchedulerDemo implements ApplicationRunner {


    @Override
    public void run(ApplicationArguments args) throws Exception {
        ConcurrentTaskScheduler scheduler = new ConcurrentTaskScheduler();
        scheduler.schedule(new Runnable() {
            @Override
            public void run() {
                System.out.println("hello world");
            }
        }, new CronTrigger("10 * * * *"));

    }
}
